home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 28 / 028.d81 / t.magic lantern < prev    next >
Text File  |  2022-08-26  |  4KB  |  240 lines

  1.  
  2.  
  3.             MAGIC LANTERN
  4.                  by
  5.             Bruce Jaeger
  6.  
  7.  
  8. COMMODORE MICROCOMPUTERS MAGAZINE
  9. September/October, 1986.
  10.  
  11. **************************************
  12.  
  13. NOTE: Because this program is written
  14. for the Commodore 128, it cannot be
  15. run like other programs on LOADSTAR.
  16. To run this program, press your 128's
  17. RESET button.  This will display a
  18. menu of all C-128 programs on this
  19. issue. Choose the program you want to
  20. run from this menu.
  21.  
  22. **************************************
  23.  
  24.  
  25.   The MAGIC LANTERN demonstrates an
  26.  
  27. animation technique that takes
  28.  
  29. advantage of the 128's ability to
  30.  
  31. store several hi-res pictures in
  32.  
  33. memory.
  34.  
  35.  
  36.   When you run MAGIC LANTERN, the
  37.  
  38. program draws a sequence of hi-res
  39.  
  40. pictures of a cartoon factory and
  41.  
  42. stores them in memory.  Like
  43.  
  44. individual frames of a movie, each
  45.  
  46. picture differs from the next only
  47.  
  48. slightly.  When the program flashes
  49.  
  50. the drawings on the screen one after
  51.  
  52. the other, the factory appears to be
  53.  
  54. running.
  55.  
  56.  
  57.   How does the program work?  A
  58.  
  59. machine-language subroutine located in
  60.  
  61. the cassette buffer transfers blocks
  62.  
  63. of memory from the storage locations
  64.  
  65. to the bitmap display area of memory.
  66.  
  67. If you are skilled enough to produce
  68.  
  69. your own hi-res pictures, you can use
  70.  
  71. MAGIC LANTERN's routines to create
  72.  
  73. your own animations.
  74.  
  75.  
  76. NUTS AND BOLTS
  77. --------------
  78.  
  79.   Because the program's author needed
  80.  
  81. to store eight high-res pictures, he
  82.  
  83. found he did not have enough room in
  84.  
  85. Bank 1 for both the program and eight
  86.  
  87. full-screen pictures.  Thus he decided
  88.  
  89. to have the "frames" of the animation
  90.  
  91. be a little under half of a screen in
  92.  
  93. size.  He used the hi-res, split-
  94.  
  95. screen mode called by the command
  96.  
  97. GRAPHIC 2,1,13.
  98.  
  99.  
  100.   If you intend to use the MAGIC
  101.  
  102. LANTERN routines in your own programs,
  103.  
  104. the author has additional information
  105.  
  106. about the following lines:
  107.  
  108.  
  109. LINE 3910: The variable NP is set
  110.  
  111. equal to the number of pages in memory
  112.  
  113. that you wish to save and swap.  The
  114.  
  115. author saved 17 pages.  Saving the
  116.  
  117. full bitmap, for example, would take
  118.  
  119. 32 pages; the full bitmap with color
  120.  
  121. memory would need 36 pages.  The value
  122.  
  123. of NP is poked into memory where the
  124.  
  125. machine-language routine can refer to
  126.  
  127. it by line 3920.
  128.  
  129.  
  130. LINE 3970: SF ("starts from") is the
  131.  
  132. decimal value of the high byte that
  133.  
  134. your save/swap is to start from; the
  135.  
  136. low high byte is always zero.  To
  137.  
  138. start from color memory, set SF=28.
  139.  
  140. For just the bitmap, set SF=32.  You
  141.  
  142. can start your cartoon at the top of
  143.  
  144. the screen-- just set the value of SF
  145.  
  146. accordingly.
  147.  
  148.  
  149.   The machine-language routine is
  150.  
  151. called with a SYS 2816, followed by
  152.  
  153. two parameters.  The first value is
  154.  
  155. the number of the picture you want to
  156.  
  157. display.  The second is either zero or
  158.  
  159. one.  If the machine-language sees
  160.  
  161. that your second parameter is zero, it
  162.  
  163. will transfer the portion of memory at
  164.  
  165. the bitmap (or wherever else you told
  166.  
  167. it through variable SF) to an area
  168.  
  169. above the BASIC program.  This is
  170.  
  171. used to save a picture for later
  172.  
  173. display.
  174.  
  175.  
  176.   If, on the other hand, the routine
  177.  
  178. finds a value of one for the second
  179.  
  180. parameter, it will transfer the
  181.  
  182. picture from memory into the bitmap
  183.  
  184. area.
  185.  
  186.  
  187.   One more note: be careful that your
  188.  
  189. BASIC program doesn't "grow up" into
  190.  
  191. the area where you store your
  192.  
  193. pictures.
  194.  
  195.  
  196. A NOTE ABOUT MAGIC LANTERN
  197. --------------------------
  198.  
  199.   If you want to see the animation
  200.  
  201. without watching the pictures drawn
  202.  
  203. each time, there is a small program,
  204.  
  205. QUICK DEMO, that will save the
  206.  
  207. machine-language routine and all of
  208.  
  209. the graphic pictures to disk.
  210.  
  211.  
  212.   To use this program, you need a disk
  213.  
  214. with at least 140 blocks free (one of
  215.  
  216. your own, not LOADSTAR!).  After
  217.  
  218. stopping MAGIC LANTERN, insert the
  219.  
  220. disk with at least 140 free blocks
  221.  
  222. into your drive and type RUN 4210.
  223.  
  224. This BSAVES the two areas of memory.
  225.  
  226. After you have saved everything,
  227.  
  228. running QUICK DEMO, which BLOADS the
  229.  
  230. pictures and routine from the disk,
  231.  
  232. will start the factory up again.
  233.  
  234.  
  235. DISK FILES THIS PROGRAM USES:
  236.  
  237. MAGIC LANTERN     QUICK DEMO
  238.  
  239. -----------< end of text >------------
  240.